package string;

public class IndexOfDemo {
    public static void main(String[] args) {
        String line = "thinking in java";
        int index = line.indexOf("in");
        System.out.println(index);//2

        index = line.indexOf("IN");//不含有给定内容是返回-1
        System.out.println(index);//-1

        index = line.indexOf("in",2);
        System.out.println(index);

        index = line.indexOf("in",3);
        System.out.println(index);

        index = line.lastIndexOf("in");
        System.out.println(index);
    }
}
